package com.charge.util;

import java.io.Serializable;

/**
 * Description :
 * Author : 91658
 * Date : 2018/6/7 10:51
 **/
public class WebResponsePage<T> implements Serializable {

    private Integer status;
    private String message;
    private T data;
    private Page page;

    public WebResponsePage() {
    }

    public WebResponsePage(Integer status, String message, T data, Page page) {
        this.status = status;
        this.message = message;
        this.data = data;
        this.page = page;
    }

    public static<T> WebResponsePage<T> createBySuccess(String message, T data, Page page) {
        return new WebResponsePage<T>(ResponseCode.SUCCESS.getCode(), message, data, page);
    }

    public static<T> WebResponsePage<T> createByFail(String message, T data, Page page) {
        return new WebResponsePage<T>(ResponseCode.FAIL.getCode(), message, data, page);
    }
    public static<T> WebResponsePage<T> createByError(String message, T data, Page page) {
        return new WebResponsePage<T>(ResponseCode.ERROR.getCode(), message, data, page);
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Page getPage() {
        return page;
    }

    public void setPage(Page page) {
        this.page = page;
    }
}
